package com.nfc.lock.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nfc.lock.entity.Region;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 区域Mapper
 */
@Mapper
public interface RegionMapper extends BaseMapper<Region> {

    /**
     * 根据父ID查询子区域
     */
    List<Region> selectByParentId(@Param("parentId") Long parentId);

    /**
     * 根据层级路径模糊查询
     */
    List<Region> selectByLevelPathLike(@Param("levelPath") String levelPath);

    /**
     * 检查是否有子区域
     */
    Long countChildren(@Param("regionId") Long regionId);
}
